#include    <stdio.h>
#include    <fcntl.h>

int main()
{
    int fd ;
    char    line[100];

    fgets( line, 100, stdin ); printf("%s", line );//打印输入的字符串
    fgets( line, 100, stdin ); printf("%s", line );
    fgets( line, 100, stdin ); printf("%s", line );

    close(0);
    fd = open("/etc/passwd", O_RDONLY);
    if ( fd != 0 ){//打开/创建失败的时候执行
        fprintf(stderr,"Could not open data as fd 0\n");
        exit(1);
    }

    fgets( line, 100, stdin ); printf("%s", line );
    fgets( line, 100, stdin ); printf("%s", line );
    fgets( line, 100, stdin ); printf("%s", line );
}